// pages/myinfo/myinfo.js
const md5 = require('../../utils/md5.js');
const http = require('../../utils/http.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
        phone:'188****8888',
        state:'完成认证',
        myImg:'',
        msg:[
            { img: '/images/wd3.png', text: '我的订单', url: '/pages/myinfo/orderList/orderList',state:1},
            { img: '/images/wd5.png', text: '我的钱包', url: '/pages/myinfo/myMoney/myMoney', state: 0 },
            { img: '/images/wd6.png', text: '邀请好友', url: '/pages/myinfo/InviteFriends/InviteFriends', state: 0 },
            { img: '/images/wd4.png', text: '我的客服', url: '/pages/myinfo/customserver/customserver', state: 0 }
            ],
        change:''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      
  },
  
 

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
     
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
      var token = wx.getStorageSync('token')
      var data = {
          method: 'User.getInfo',
          token: token,
      }
      var arr = http.sorts(data)
      var that = this
      data.sign = md5.hex_md5(arr)
      http._post(data, res => {
          this.setData({
              phone: res.data.data.userInfo.telephone,
              myImg: res.data.data.userInfo.head_portrait,
              state:res.data.data.userInfo.name
          })
      })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})